#include "aip8563_api.h"
#include "aip8563_iic.h"

#if _REAL_TIME_CLOCK_SOURCE_ == _EXTERNAL_CLOCK_SOURCE_

uint8_t BcdToHex(uint8_t Bcd)
{
  uint8_t HexCode = 0;

  HexCode = (((Bcd & 0xF0) >> 4) * 10) + (Bcd & 0x0F);
  return HexCode;
}

uint8_t HexToBcd(uint8_t Hex)
{
  uint8_t BcdCode = 0;

  BcdCode = ((Hex / 10) << 4) | (Hex % 10);
  return BcdCode;
}

void Aip8563WriteRegister(uint8_t Register, uint8_t Data)
{
  Aip8563IicWriteOneByte(AIP8563_IIC_OPERATION_ADDR, Register, Data);
}

uint8_t Aip8563ReadRegister(uint8_t Register)
{
  uint8_t RegisterValue = 0;

  RegisterValue = Aip8563IicReadOneByte(AIP8563_IIC_OPERATION_ADDR, Register);
  return RegisterValue;
}

#endif
